package com.example.springblog.mapper;

import com.example.springblog.moder.Blog;
import com.example.springblog.moder.Result;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BlogInfoMapper {
    @Select("select * from blog where delete_flag = 0 order by create_time desc")
    public List<Blog> getBlogs();

    @Select("select * from blog where id = #{id} and delete_flag = 0")
    public Blog getBlogDetail(Integer id);

    @Update("update ")
    boolean update(Blog blog);

    @Insert("insert into blog(title,content, user_id) values (#{title},#{content},#{userId})")
    Integer insert(Blog blog);
}
